fs: Prevent overflows when assigning returned values from read_number()
authorLidong Chen <lidong.chen@oracle.com>
Tue, 21 Jan 2025 19:02:38 +0000 (19:02 +0000)
committerMiao Wang <shankerwangmiao@gmail.com>
Sun, 15 Feb 2026 13:50:20 +0000 (13:50 +0000)
commiteee111d1880ff84fc9cdcf3f92f04626a745f1ed
tree202a974ee40cc94e0df03dec6fadca911786c845
parent1163d4462d7d3e0dc00757e05b2d90806fbd6ada
fs: Prevent overflows when assigning returned values from read_number()

The direct assignment of the unsigned long long value returned by
read_number() can potentially lead to an overflow on a 32-bit systems.
The fix replaces the direct assignments with calls to grub_cast()
which detects the overflows and safely assigns the values if no
overflow is detected.

Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name fs-Prevent-overflows-when-assigning-returned-values-from-.patch
grub-core/fs/cpio_common.c
grub-core/fs/tar.c